<!DOCTYPE html><html>
    <head>
         <style type="text/css">
            .div1{
                width: 100px;
                height: 100px;
                background-color: red;
                position:relative;
            }
            .div2{
                width: 50px;
                height:50px;
                background-color: blue;
                position:absolute;
                left:50%;
                margin-left: -25px;                
                top: 50%;
                margin-top:-25px;
                }
        </style>
    </head>
    <body>
        <div class="div1">
        <div class="div2"></div>
        
    </div>
    </body>
</html>
    